#include <stdio.h>
#include <stdlib.h>
typedef int datatype;
 typedef struct SLnode
{
	datatype data;
	struct SLnoode* next;
}SLnode;
 SLnode* deldata(SLnode* phead, datatype x)
 {
	 SLnode* head, * tail;
	 head = tail = NULL;
	 SLnode* pucr = phead;
	 while (pucr)
	 {
		 if ((pucr->data) != x)
		 {
			 if (head ==NULL)
			 {
				 head = tail = pucr;
			 }
			 else
			 {
				 tail->next = pucr;
				 tail = tail->next;
			 }
		 }
			 pucr = pucr->next;
	 }
	 if (tail)
	 {
		 tail->next = NULL;
	 }
	 return head;
 }
int main()
{
	SLnode* node1 = (SLnode*)malloc(sizeof(SLnode));
	node1->data = 1;
	SLnode* node2 = (SLnode*)malloc(sizeof(SLnode));
	node2->data = 4;
	SLnode* node3 = (SLnode*)malloc(sizeof(SLnode));
	node3->data = 5;
	SLnode* node4 = (SLnode*)malloc(sizeof(SLnode));
	node4->data = 6;
	SLnode* node5 = (SLnode*)malloc(sizeof(SLnode));
	node5->data = 4;
	SLnode* node6 = (SLnode*)malloc(sizeof(SLnode));
	node6->data = 4;
	node1->next = node2;
	node2->next = node3;
	node3->next = node4;
	node4->next = node5;
	node5->next = node6;
	node6->next = NULL;
	SLnode* plist = node1;
	while (node1)
	{
		printf("%d->", node1->data);
		node1= node1->next;
	}
	printf("NULL\n");
	SLnode* ret=deldata(plist, 4);
	while (ret)
	{
		printf("%d->", ret->data);
		ret = ret->next;
	}
	printf("NULL\n");
	return 0;
}